package main

import (
	"flag"
	"log"
	"net/http"
	"strconv"
)

var port int
var dir string

func main() {
	flag.IntVar(&port, "p", 80, "port")
	flag.StringVar(&dir, "d", "", "dir")
	flag.Parse()

	if dir == "" {
		log.Fatal("dir required")
	}

	http.Handle("/", http.FileServer(http.Dir(dir)))
	http.ListenAndServe(":"+strconv.Itoa(port), nil)
}
